﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using BizControl.Presentation.Infrastructure.Properties;

namespace BizControl.Presentation.Infrastructure.Controls
{
  /// <summary>
  /// Interaction logic for ConfirmationDlg.xaml
  /// </summary>
  public partial class ConfirmationDlg : Window
  {
    public ConfirmationDlg(string message, string title, string confirmButtonText, string cancelButtonText, string confirmWithoutDoingAnythingButtonText)
    {
      InitializeComponent();
      Title = title;
      tbContent.Text = message;
      ConfirmText.Text = confirmButtonText;
      CancelText.Text = cancelButtonText;
      ConfirmWithoutDoingAnythingText.Text = confirmWithoutDoingAnythingButtonText;
    }

    public ConfirmationDlg(string message)
      : this(message, Captions.CaptionConfirmation, Captions.SaveButtonCaption, Captions.CancelButtonCaption, Captions.ConfirmWithoutSavingCaption)
    {
    }

    public ConfirmationDlg()
      : this (Captions.ConfirmSaveNavigateAway, Captions.CaptionConfirmation, Captions.SaveButtonCaption, Captions.CancelButtonCaption, Captions.ConfirmWithoutSavingCaption)
    {
    }

    private void ConfirmButton_Click(object sender, RoutedEventArgs e)
    {
      Result = DlgResult.Confirm;
      Close();
    }

    private void CancelButton_Click(object sender, RoutedEventArgs e)
    {
      Result = DlgResult.Cancel;
      Close();
    }

    private void ConfirmWithoutDoingAnything_Click(object sender, RoutedEventArgs e)
    {
      Result = DlgResult.CancelWithoutSaving;
      Close();
    }

    public DlgResult Result
    {
      get;
      private set;
    }
  }
}
